#include<iostream>
#include<string>
class Test
{
    public:
    Test()
    {
        std::cout << "构造函数" << std::endl;
        a = new int;
    }
    //深度拷贝
    Test(Test& t)
    {
        std::cout << "拷贝构造函数" << std::endl;
        a = new int;
        *a = *t.a;
    }
    void operator=(Test &t)
    {
        std::cout << "赋值运算符的重载" << std::endl;
        delete a;
        a = new int;
        *a = *t.a;
    }
    ~Test()
    {
        std::cout << "析构函数" << std::endl;
        delete a;
    }
    private:
        int *a;
};
Test func(Test &t)
{
    return t;
}
int main()
{
    // Test();//匿名对象：声明周期只有一行
    Test t;
    return 0;
}